package com.yilin.medical.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.yilin.medical.http.JxRequestParams;

public class JxSolrUtil {
	// 联想接口
	public JxRequestParams getParamsCommunityName(String input, String page,
			String pageSize) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "communityName:" + input);
		params.put("fl",
				"latitude,longitude,avgPrice,communityName,id,hsCnt,bdId,bbdId,avgPrice");
		params.put("wt", "json");
		int pagestart = (Integer.parseInt(page) - 1)
				* Integer.parseInt(pageSize);
		params.put("start", pagestart + "");
		params.put("rows", pageSize);
		return params;
	}

	// 联想接口,新
	/*
	 * http://searchtest.zhagen.com/solr/jxCommunity/select?q=communityName:*wd*
	 * OR temp1:*一* OR addr:*一* OR
	 * bbdName:*一*&wt=json&start=0&rows=10&fl=id+communityName
	 * +hsCnt+avgPrice+longitude+latitude+addr+bbdName
	 */
	public JxRequestParams getParamsThinkESF(String q, String input) {
		JxRequestParams params = new JxRequestParams();
		// params.put("q", q + ":*" + input + "*" + " OR temp1:*" + input +
		// "*");
		params.put("q", q + ":*" + input + "*" + " OR temp1:*" + input + "*"
				+ " OR addr:*" + input + "*" + " OR bbdName" + ":*" + input
				+ "*");
		params.put("fl",
				"communityName,id,latitude,longitude,hsCnt,bdId,bbdId,avgPrice,addr");
		params.put("wt", "json");
		params.put("start", "0");
		params.put("rows", "10");
		// params.put("sort", "hsCnt asc");
		return params;
	}

	public JxRequestParams getParamsThinkZF(String q, String input) {
		JxRequestParams params = new JxRequestParams();
		// params.put("q", q + ":*" + input + "*" + " OR temp1:*" + input +
		// "*");
		params.put("q", q + ":*" + input + "*" + " OR temp1:*" + input + "*"
				+ " OR addr:*" + input + "*" + " OR bbdName" + ":*" + input
				+ "*");
		params.put("fl", "communityName,id,latitude,longitude,hrCnt,addr");
		params.put("wt", "json");
		params.put("start", "0");
		params.put("rows", "10");
		// params.put("sort", "hsCnt asc");
		return params;
	}

	// 搜索小区,新
	public JxRequestParams getParamsSearchHouseNew(String communityname) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", communityname);
		params.put("wt", "json");
		return params;
	}

	// 首页小区房源列表
	public JxRequestParams getParamsCommunityHouseList(String communityName,
			String page, String pageSize) {
		return getParamsCommunityHouseList(communityName, page, pageSize, "");
	}

	// 首页小区房源列表
	public JxRequestParams getParamsCommunityHouseList(String communityName,
			String page, String pageSize, String paixu) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(communityName)) {
			params.put("q", "*:*");
		} else {
			params.put("q", "communityName:" + communityName);
		}
		if (JxStringUtils.isNullOrEmpty(paixu)) {
			paixu = "disUpdateTime desc";
		}
		params.put("sort", paixu);
		params.put("fq", "houseStatus:[1 TO *]");
		params.put(
				"fl",
				"numFound,houseTitle,houseTotalPrice,fullViewPath,updateTime,"
						+ "id,charge,google,buildingArea,totalFloors,floorNo,hallNums,bedroomNums,"
						+ "communityId,supportName,disCreateTime,disUpdateTime, bbdName1, bdName,,agentName");
		params.put("wt", "json");
		int pagestart = (Integer.parseInt(page) - 1)
				* Integer.parseInt(pageSize);
		params.put("start", pagestart + "");
		params.put("rows", pageSize);
		return params;
	}

	// 房源详情页
	public JxRequestParams getParamsHouseDetail(String id) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(id)) {
			params.put("q", "*:*");
		} else {
			params.put("q", "id:" + id);
		}
		params.put(
				"fl",
				"picBigPath,picListPath,picSmallPath,tabName,"
						+ "buildName,hdName,houseTitle,houseTotalPrice,"
						+ "houseUnitPrice,hoName,hallNums,bedroomNums"
						+ ",fullViewPath,bathroomNums,google,buildingArea,totalFloor,floorNo,"
						+ "updateTime,charge,finishedYear,houseAge,houseType,houseTypeName"
						+ ",createTime,totalFloors,ifHaveBasement,google,ifHaveCarage,ifHaveGarden,ifHaveParking,"
						+ "houseInfo,houseText,communityId,communityName,supportName,disCreateTime,disUpdateTime,"
						+ "bbdName, bdName,id,agentName,mobile");
		params.put("wt", "json");
		return params;
	}

	// 小区详情页
	public JxRequestParams getParamsCommunityDetail(String id) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(id)) {
			params.put("q", "*:*");
		} else {
			params.put("q", "id:" + id);
		}
		params.put(
				"fl",
				"picBigPath,picListPath,picSmallPath,"
						+ "communityName,fullViewPath,avgPrice,communityDesc,"
						+ "buildingType,communityTypeName,propertyType,buildFinishedYear,"
						+ "developerName,buildingTypeName,communityText,quanpin,id,hsCnt,parkingSpace,greenRate,volumeRate,google,latitude,longitude");
		params.put("wt", "json");
		return params;
	}

	/**
	 * http://searchtest.zhagen.com/solr/jxRent/select? q=appSubwayLine:13
	 * &wt=xml&group=true &group.field=appSubwayStation
	 * &fl=appSubwayLine,appSubwayStation,longitude,latitude &rows=1000
	 * 
	 * */
	// 地铁找房
	public JxRequestParams getHousesBySubway(String appSubwayLine) {
		JxRequestParams params = new JxRequestParams();
		params.put("fl", "appSubwayLine,appSubwayStation,longitude,latitude");
		params.put("rows", 1000 + "");
		params.put("fq", "houseStatus:[1 TO *]");
		params.put("group", "true");
		params.put("group.field", "appSubwayStation");
		params.put("wt", "json");
		params.put("q", "appSubwayLine:" + appSubwayLine);
		return params;
	}

	/**
	 * http://searchtest.zhagen.com/solr/jxRent/select?q=appSubwayLine:13 AND
	 * longitude:[116.315904 TO 116.515904] AND latitude:[39.979750 TO
	 * 40.979751]&wt=xml&group=true&group.field=communityName&fl=appSubwayLine,
	 * communityName&rows=1000 http://searchtest.zhagen.com/solr/jxRent/select?
	 * group=true& rows=1000& wt=json& group.field=communityName&
	 * fl=google,latitude,longitude,id,communityName,communityId&
	 * q=Latitude:[39.874327 TO 39.944533] AND Longitude:[116.425631 TO
	 * 116.468417] AND appSubwayLine:9
	 * 
	 * */
	public JxRequestParams getHousesXiaoQuBySubway(String latitude,
			String longitude, String appSubwayLine) {
		JxRequestParams params = null;
		params = new JxRequestParams();
		double julix1 = Double.parseDouble(latitude.split(",")[0]);
		double julix2 = Double.parseDouble(latitude.split(",")[1]);
		double juliy1 = Double.parseDouble(longitude.split(",")[0]);
		double juliy2 = Double.parseDouble(longitude.split(",")[1]);
		// params.put("q", "appSubwayLine:"+appSubwayLine);
		if (julix1 > julix2 && juliy1 > juliy2) {
			params.put("q", "latitude:[" + julix2 + " TO " + julix1
					+ "] AND longitude:[" + juliy2 + " TO " + juliy1
					+ "] AND appSubwayLine:" + appSubwayLine);
		} else if (julix2 > julix1 && juliy1 > juliy2) {
			params.put("q", "latitude:[" + julix1 + " TO " + julix2
					+ "] AND longitude:[" + juliy2 + " TO " + juliy1
					+ "] AND appSubwayLine:" + appSubwayLine);
		} else if (julix1 > julix2 && juliy2 > juliy1) {
			params.put("q", "latitude:[" + julix2 + " TO " + julix1
					+ "] AND longitude:[" + juliy1 + " TO " + juliy2
					+ "] AND appSubwayLine:" + appSubwayLine);
		} else if (julix1 < julix2 && juliy1 < juliy2) {
			params.put("q", "latitude:[" + julix1 + " TO " + julix2
					+ "] AND longitude:[" + juliy1 + " TO " + juliy2
					+ "] AND appSubwayLine:" + appSubwayLine);
		}
		params.put("fl",
				"google,latitude,longitude,id,communityName,communityId");
		params.put("rows", 1000 + "");
		params.put("group", "true");
		params.put("group.field", "communityName");
		params.put("wt", "json");
		params.put("fq", "houseStatus:[1 TO *]");
		return params;
	}

	// 首页数据帅选
	public JxRequestParams getParamsHomeMapDetail(String latitude,
			String longitude, String limit, String xiaoqu, boolean isESF,
			boolean isLocation, String distance) {
		JxRequestParams params = null;
		params = new JxRequestParams();
		if (!isLocation) {
			if (JxStringUtils.isNullOrEmpty(xiaoqu)) {
				double julix1 = Double.parseDouble(latitude.split(",")[0]);
				double julix2 = Double.parseDouble(latitude.split(",")[1]);
				double juliy1 = Double.parseDouble(longitude.split(",")[0]);
				double juliy2 = Double.parseDouble(longitude.split(",")[1]);
				if (julix1 > julix2 && juliy1 > juliy2) {
					if (!JxStringUtils.isNullOrEmpty(limit)) {
						params.put("q", "latitude:[" + julix2 + " TO " + julix1
								+ "] AND longitude:[" + juliy2 + " TO "
								+ juliy1 + "]" + " AND " + limit);
					} else {
						params.put("q", "latitude:[" + julix2 + " TO " + julix1
								+ "] AND longitude:[" + juliy2 + " TO "
								+ juliy1 + "]");
					}

				} else if (julix2 > julix1 && juliy1 > juliy2) {
					if (!JxStringUtils.isNullOrEmpty(limit)) {
						params.put("q", "latitude:[" + julix1 + " TO " + julix2
								+ "] AND longitude:[" + juliy2 + " TO "
								+ juliy1 + "]" + " AND " + limit);
					} else {
						params.put("q", "latitude:[" + julix1 + " TO " + julix2
								+ "] AND longitude:[" + juliy2 + " TO "
								+ juliy1 + "]");
					}

				} else if (julix1 > julix2 && juliy2 > juliy1) {
					if (!JxStringUtils.isNullOrEmpty(limit)) {
						params.put("q", "latitude:[" + julix2 + " TO " + julix1
								+ "] AND longitude:[" + juliy1 + " TO "
								+ juliy2 + "]" + " AND " + limit);
					} else {
						params.put("q", "latitude:[" + julix2 + " TO " + julix1
								+ "] AND longitude:[" + juliy1 + " TO "
								+ juliy2 + "]");
					}

				} else if (julix1 < julix2 && juliy1 < juliy2) {
					params.put("q", "latitude:[" + julix1 + " TO " + julix2
							+ "] AND longitude:[" + juliy1 + " TO " + juliy2
							+ "]" + " AND " + limit);
				}
			} else {
				if (!JxStringUtils.isNullOrEmpty(limit)) {
					limit += " AND communityName:" + xiaoqu;
					params.put("q", "communityName:" + xiaoqu + " AND " + limit);
				} else {
					params.put("q", "communityName:" + xiaoqu);
				}

			}
			if (isESF) {
				params.put("fl",
						"google,latitude,avgPrice,longitude,id,communityName,communityId");
				params.put("rows", 1000 + "");
				params.put("group", "true");
				params.put("group.field", "communityId");
				params.put("wt", "json");
				params.put("fq", "houseStatus:[1 TO *]");
			} else {
				params.put("fl",
						"google,latitude,longitude,id,communityName,communityId");
				params.put("rows", 1000 + "");
				params.put("group", "true");
				params.put("group.field", "communityName");
				params.put("wt", "json");
				params.put("fq", "houseStatus:[1 TO *]");
			}
		} else {
			try {
				if (!JxStringUtils.isNullOrEmpty(limit)) {
					if (isESF) {
						params.put(
								"q",
								URLEncoder.encode("houseStatus:" + "[1 TO *]"
										+ " AND " + limit, "utf-8"));
					} else {
						params.put(
								"q",
								URLEncoder.encode("houseStatus:" + "[1 TO *]"
										+ " AND " + limit, "utf-8"));
					}
				} else {
					if (isESF) {
						params.put("q", URLEncoder.encode("houseStatus:"
								+ "[1 TO *]", "utf-8"));
					} else {
						params.put("q", URLEncoder.encode("houseStatus:"
								+ "[1 TO *]", "utf-8"));
					}

				}
				params.put("group", "true");
				params.put("fq", URLEncoder.encode("{!geofilt}", "utf-8"));
				params.put("pt", latitude + "," + longitude);
				params.put("sfield", "google");// sort=geodist() asc
				params.put("sort", URLEncoder.encode("geodist() asc", "utf-8"));
				params.put("wt", "json");
				params.put("rows", 20 + "");
				params.put("d", distance);
				params.put("fl",
						"google,latitude,avgPrice,longitude,id,communityName,communityId");
				params.put("group.field", "communityName");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}

		return params;
	}

	// 首页数据帅选
	/**
	 * 12-04 11:18:34.836: E/url(23708):
	 * http://searchtest.zhagen.com/solr/jxHouse
	 * /select?group=true&rows=40&wt=json
	 * &group.field=bdName&fl=bdId,bdName,longitude,latitude&q=houseStatus:[1 TO
	 * *]
	 * 
	 * */
	public JxRequestParams getParamsAllMapAreas(String limit, boolean isESF,
			String latitude, String longitude) {
		JxRequestParams params = null;
		params = new JxRequestParams();
		if ((!JxStringUtils.isNullOrEmpty(latitude))
				&& (!JxStringUtils.isNullOrEmpty(longitude))) {
			double julix1 = Double.parseDouble(latitude.split(",")[0]);
			double julix2 = Double.parseDouble(latitude.split(",")[1]);
			double juliy1 = Double.parseDouble(longitude.split(",")[0]);
			double juliy2 = Double.parseDouble(longitude.split(",")[1]);
			if (julix1 > julix2 && juliy1 > juliy2) {
				params.put("q", "bdLatitude:[" + julix2 + " TO " + julix1
						+ "] AND bdLongitude:[" + juliy2 + " TO " + juliy1
						+ "]" + " AND houseStatus:[1 TO *]");
			} else if (julix2 > julix1 && juliy1 > juliy2) {
				params.put("q", "bdLatitude:[" + julix1 + " TO " + julix2
						+ "] AND bdLongitude:[" + juliy2 + " TO " + juliy1
						+ "]" + " AND houseStatus:[1 TO *]");
			} else if (julix1 > julix2 && juliy2 > juliy1) {
				params.put("q", "bdLatitude:[" + julix2 + " TO " + julix1
						+ "] AND bdLongitude:[" + juliy1 + " TO " + juliy2
						+ "]" + " AND houseStatus:[1 TO *]");
			} else if (julix1 < julix2 && juliy1 < juliy2) {
				params.put("q", "bdLatitude:[" + julix1 + " TO " + julix2
						+ "] AND bdLongitude:[" + juliy1 + " TO " + juliy2
						+ "]" + " AND houseStatus:[1 TO *]");
			}
		} else {
			params.put("q", "houseStatus:[1 TO *]");
		}
		// http://searchtest.51zhagen.com/solr/jxHouse/select?q=houseStatus:1.0%20AND%20bedroomNums:2&wt=xml&fl=bdId,bdName,longitude,latitude&group=true&group.field=bdName&rows=40&sort=bdId%20asc
		params.put("fl", "bdId,bdName,bdLongitude,bdLatitude");
		params.put("rows", 40 + "");
		params.put("group", "true");
		params.put("group.field", "bdName");
		params.put("wt", "json");
		return params;
	}

	// 地图二级商圈数据
	/**
	 * http://searchtest.zhagen.com/solr/jxRent/select?q=bdLongitude:[116.315904
	 * TO 116.515904] AND bdLatitude:[39.979750 TO 40.979751]&
	 * wt=xml&group=true&group.field=bdName&fl=bbdName,bdName&rows=50
	 * 
	 * ***/
	public JxRequestParams getParamsDistrictMapAreas(String latitude,
			String longitude, boolean isESF) {
		JxRequestParams params = null;
		params = new JxRequestParams();
		double julix1 = Double.parseDouble(latitude.split(",")[0]);
		double julix2 = Double.parseDouble(latitude.split(",")[1]);
		double juliy1 = Double.parseDouble(longitude.split(",")[0]);
		double juliy2 = Double.parseDouble(longitude.split(",")[1]);
		if (julix1 > julix2 && juliy1 > juliy2) {
			params.put("q", "bbdLatitude:[" + julix2 + " TO " + julix1
					+ "] AND bbdLongitude:[" + juliy2 + " TO " + juliy1 + "]");
		} else if (julix2 > julix1 && juliy1 > juliy2) {
			params.put("q", "bbdLatitude:[" + julix1 + " TO " + julix2
					+ "] AND bbdLongitude:[" + juliy2 + " TO " + juliy1 + "]");
		} else if (julix1 > julix2 && juliy2 > juliy1) {
			params.put("q", "bbdLatitude:[" + julix2 + " TO " + julix1
					+ "] AND bbdLongitude:[" + juliy1 + " TO " + juliy2 + "]");
		} else if (julix1 < julix2 && juliy1 < juliy2) {
			params.put("q", "bbdLatitude:[" + julix1 + " TO " + julix2
					+ "] AND bbdLongitude:[" + juliy1 + " TO " + juliy2 + "]");
		}
		if (isESF) {
			params.put("fl", "bbdName,bbdLongitude,bbdLatitude");
			params.put("rows", 1000 + "");
			params.put("group", "true");
			params.put("group.field", "bdName");
			params.put("wt", "json");
		} else {
			params.put("fl", "bbdName,bbdLongitude,bbdLatitude");
			params.put("rows", 1000 + "");
			params.put("group", "true");
			params.put("group.field", "bbdName");
			params.put("wt", "json");
		}
		params.put("fq", "houseStatus:[1 TO *]");
		return params;
	}

	// 首页小区房源列表帅选(bedroomNums=？？)
	public JxRequestParams getParamsCommunityHouseLimitList(
			String communityName, String page, String pageSize, String limit) {
		return getParamsCommunityHouseLimitList(communityName, page, pageSize,
				limit, "");
	}

	// 距离定位区域几公里内的数据搜索
	// 首页小区房源列表帅选(bedroomNums=？？)
	public JxRequestParams getParamsCommunityHouseLimitList(
			String communityName, String page, String pageSize, String limit,
			String paixu) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(communityName)) {
			params.put("q", "*:*");
		} else {
			params.put("q", "communityName:" + communityName);
		}
		if (JxStringUtils.isNullOrEmpty(paixu)) {
			paixu = "finalScore desc,updateTime desc";
		} else {
			paixu = "finalScore desc," + paixu;
		}
		if (!JxStringUtils.isNullOrEmpty(limit)) {
			params.put("fq", limit + " AND houseStatus:[1 TO *]");
		} else {
			params.put("fq", "houseStatus:[1 TO *]");
		}
		params.put("sort", paixu);
		params.put(
				"fl",
				"numFound,houseTitle,houseStatus,isNewTag,charge,houseTotalPrice,fullViewPath,updateTime,"
						+ "id,google,tabName,bbdName,addr,source,hoName,rental,communityName,buildingArea,totalFloors,floorNo,rentType,hallNums,bedroomNums,"
						+ "communityId,disCreateTime,picBigPath,finishedYear");
		params.put("wt", "json");
		int pagestart = (Integer.parseInt(page) - 1)
				* Integer.parseInt(pageSize);
		params.put("start", pagestart + "");
		params.put("rows", pageSize);
		return params;
	}

	public JxRequestParams getBedroomsParams(String communityName) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "communityName:" + communityName);
		params.put("fq", "houseStatus:[1 TO *]");
		params.put("fl", "bedroomNums");
		params.put("wt", "json");
		return params;
	}

	public JxRequestParams getBedroomsParamsZF(String communityName) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "communityName:" + communityName);
		params.put("fq", "houseStatus:[1 TO *]");
		params.put("fl", "rentType");
		params.put("wt", "json");
		return params;
	}

	public JxRequestParams getParamsNotifyList(String channelId, String userId,
			String deviceId, int type, String createTime, int page, int pageSize) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(userId)) {
			params.put("q", "deviceId:" + deviceId
					+ " AND deviceType:1 AND type:" + type
					+ " AND status:1 AND createDate:" + createTime);
		} else {
			params.put("q", "userId:" + userId + " AND type:" + type
					+ " AND status:1 AND createDate:" + createTime);
		}
		params.put("sort", "createDate desc");
		params.put(
				"fl",
				"houseId,houseTitle,houseStatus,trend,type,imageUrl,bathroom,bedroom,price,"
						+ "totalPrice,totalFloorNo,floorNo,hall,area,favoriteId,favoriteType,createTime");
		params.put("wt", "json");
		int pagestart = (page - 1) * pageSize;
		params.put("start", pagestart + "");
		params.put("rows", pageSize + "");
		return params;
	}

	public JxRequestParams getParamsNotifySearchList(String channelId,
			String userId, String createTime) {
		JxRequestParams params = new JxRequestParams();
		if (JxStringUtils.isNullOrEmpty(userId)) {
			params.put("q", "*:*");
		} else {
			params.put("q", "baiduUserId:" + channelId
					+ " AND status:1 AND createTime:" + createTime);
		}
		params.put("sort", "createTime desc");
		params.put(
				"fl",
				"jxHouseId,houseTitle,imageUrl,bathroom,bedroom,price,"
						+ "totalFloorNo,floorNo,hall,area,type,historyId,totalPrice,bdId,houseType,acreage,houseage,feature");
		params.put("wt", "json");
		return params;
	}

	// public AbBase64RequestParams getParamsNotifyNum(String type, String id) {
	// AbBase64RequestParams params = new AbBase64RequestParams();
	// if (JxStringUtils.isNullOrEmpty(id)) {
	// params.put("q", "*:*");
	// } else {
	// params.put("q", "id:" + id + " AND " + "type:" + type);
	// }
	// params.put("fl", "");
	// params.put("wt", "json");
	// JxLogUtil.log(params.toString());
	// return params;
	// }

	public JxRequestParams getParamsCommunityHouseLimitList(
			String communityName, String page, String pageSize, String limit,
			String paixu, String google, String distance) {

		JxRequestParams params = new JxRequestParams();

		try {
			// params.put("q", URLEncoder.encode("{!func}geodist()","utf-8"));
			// params.put("fq", URLEncoder.encode("{!geofilt}","utf-8"));
			// params.put("sfield", "google");
			// params.put("pt", "39.909153,116.244064");
			// params.put("d", "5");
			// params.put("sort", URLEncoder.encode("score asc","utf-8"));
			// params.put("fl", "communityName,score,google");
			String q = URLEncoder.encode("{!func}geodist()", "utf-8");
			q += "&fq=";
			q += URLEncoder.encode("{!geofilt}", "utf-8");
			q += "&sfield=google&pt=" + google + "&d=" + distance;
			if (JxStringUtils.isNullOrEmpty(communityName)) {

			} else {
				q += "&fq=communityName:" + communityName;
			}
			params.put("q", q);

			if (JxStringUtils.isNullOrEmpty(paixu)) {
				paixu = "finalScore desc,score asc,updateTime desc";
			} else {
				paixu = "finalScore desc," + paixu;
			}
			if (!JxStringUtils.isNullOrEmpty(limit)) {
				params.put("fq", URLEncoder.encode(limit
						+ " AND houseStatus:[1 TO *]", "utf-8"));
			} else {

				params.put("fq",
						URLEncoder.encode("houseStatus:[1 TO *]", "utf-8"));
			}
			params.put("sort", URLEncoder.encode(paixu, "utf-8"));
			params.put(
					"fl",
					"numFound,houseTitle,charge,houseTotalPrice,fullViewPath,updateTime,"
							+ "id,houseStatus,bbdName,isNewTag,google,tabName,score,source,addr,hoName,communityName,rental,buildingArea,disUpdateTime,totalFloors,floorNo,hallNums,bedroomNums,"
							+ "communityId,disCreateTime,picBigPath,finishedYear,rentType");
			params.put("wt", "json");
			int pagestart = (Integer.parseInt(page) - 1)
					* Integer.parseInt(pageSize);
			params.put("start", pagestart + "");
			params.put("rows", pageSize);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return params;

	}

	/**
	 * 原来SolrUtil类的方法
	 */

	// 首页数据获取
	public JxRequestParams getParamsHomeMapDetail(String latitude,
			String longitude) {
		JxRequestParams params = new JxRequestParams();
		double x = Double.parseDouble(longitude) + 0.01;
		double y = Double.parseDouble(longitude) + 0.01;
		params.put("q", "latitude:[" + latitude + " TO " + x
				+ "] AND longitude:[" + longitude + " TO " + y + "]");
		params.put("fl", "google,changCnt,latitude,longitude,communityName");
		params.put("wt", "json");
		return params;
	}

	// 首頁篩選数据获取
	public JxRequestParams getParamsHomeMapDetail(String latitude,
			String longitude, String limit) {
		JxRequestParams params = new JxRequestParams();
		double x = Double.parseDouble(longitude) + 0.01;
		double y = Double.parseDouble(longitude) + 0.01;
		params.put("q", limit + "latitude:[" + latitude + " TO " + x
				+ "] AND longitude:[" + longitude + " TO " + y + "]");
		params.put("fl", "google,changCnt,latitude,longitude,communityName");
		params.put("wt", "json");
		params.put("facet", "communityId");
		params.put("facet.field", "json");
		return params;
	}

	// 联想接口
	public JxRequestParams getParamsCommunityName(String input) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "communityName:" + input);
		params.put("fl", "communityName,communityId");
		params.put("wt", "json");
		return params;
	}

	// 首页单个小区列表
	public JxRequestParams getParamsCommunityHouseList(String communityName) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "communityName:" + communityName);
		params.put(
				"fl",
				"numFound,houseTitle,houseTotalPrice,photoPath,updateTime,id,google,buildingArea,totalFloors,floorNo,hallNums,bedroomNums,communityId");
		params.put("wt", "json");
		return params;
	}

	// 列表
	public JxRequestParams getParamsHouseList(String communityName) {
		JxRequestParams params = new JxRequestParams();
		params.put("q", "*:*");
		params.put(
				"fl",
				"numFound,houseTitle,houseTotalPrice,photoPath,updateTime,id,google,buildingArea,totalFloors,floorNo,hallNums,bedroomNums,communityId");
		params.put("wt", "json");
		return params;
	}
}
